package com.hypo.mapper;

import com.hypo.pojo.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    //@Select("select * from dept")
    //手动映射
    //@Results({
    //        @Result(column = "create_time",property = "createTime"),
    //        @Result(column = "update_time",property = "updateTime")
    //})
    //@Select("select * from dept")
    //起别名
    //@Select("select id, name, create_time createTime, update_time updateTime from dept")
    //开启驼峰命名(推荐)
    @Select("select * from dept")
    public List<Dept> findAll();

    @Delete("delete from dept where id=#{id}")
    Integer del(Integer id);

    @Insert("insert into dept(name, create_time, update_time) values (#{name},#{createTime},#{updateTime})")
    Integer add(Dept dept);


    @Select("select * from dept where id=#{id}")
    Dept getById(Integer id);

    @Update("update dept set name=#{name},update_time=#{updateTime} where id=#{id}")
    Integer modify(Dept dept);
}
